<!DOCTYPE html>
<html lang="en">

<include file="CommonSidebar:common-head"/>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/css/common.css">
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<body>


<div id="wrapper">

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <hr>
                <if condition="$GO">
                    <a href="{:U('/ERPAPI/Match_All_YD_Code_Idnex')}">
                        <button class="btn  btn-primary">不选择取消返回</button>
                    </a>
                    <else/>
                <a href="{:U('/ERPAPI/GetOrderData')}">
                    <button class="btn  btn-primary">不选择取消返回</button>
                </a>
                </if>
                <hr>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">康欣药店内码列表</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" data-parent="#accordion"
                                   href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                    搜索栏
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel"
                             aria-labelledby="headingOne">
                            <div class="panel-body">
                                <form action="{:U('/ERPAPI/GETYDCODEINDEX')}" class="form-horizontal"
                                      method="get">
                                    <input name="buyer_id" type="hidden" value="{$buyer_id}">

                                    <div class="form-group">
                                        <label style="color: red;" class="col-sm-2 control-label">参考药店名称</label>

                                        <div class="col-sm-4">
                                            <input readonly name="CKYDNAME" style="color: red;" type="text"
                                                   class="form-control" value="{$CKYDNAME}">
                                        </div>
                                        <label style="color: red;" class="col-sm-2 control-label">参考详细地址</label>

                                        <div class="col-sm-4">
                                            <input style="color: red;" name="CKDZ" type="text" class="form-control"
                                                   value="{$CKDZ}" readonly>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">药店名称</label>

                                        <div class="col-sm-4">
                                            <input name="YDNAME" type="text" class="form-control" value="{$YDNAME}">
                                        </div>
                                        <label class="col-sm-2 control-label">详细地址</label>

                                        <div class="col-sm-4">
                                            <input name="DZ" type="text" class="form-control" value="{$DZ}">
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-10 col-sm-offset-2">
                                            <button type="submit" class="btn  btn-primary">筛选</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        系统建议药店列表
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                <tr>
                                    <th style="text-align:center">ERP药店内码</th>
                                    <th style=" text-align:center">药店名称</th>
                                    <th style=" text-align:center">详细地址</th>
                                    <th style="text-align:center">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <if condition="$DATA">

                                    <foreach name="DATA" item="v">
                                        <tr class="odd gradeX">
                                            <td>{$v.ERP_CODE}</td>
                                            <td>{$v.NAME}</td>
                                            <td>{$v.DZ}</td>
                                            <td>
                                                <input type="button" class="btn-cancel" name="close" value="选择"/>
                                                <input type="hidden" name="ID" value="{$v.ID}">
                                            </td>
                                        </tr>
                                    </foreach>
                                    <else/>
                                    <lable style="color: red;font-size: 50px;">无建议数据，请手动查询</lable>
                                </if>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->


<include file="CommonSidebar:common-script"/>
<script src="__ROOT__/Application/Admin/Public/js/jquery.datetimepicker.js"></script>
<!-- DataTables JavaScript -->
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
<script>
    $(document).ready(function () {
        $('#dataTables-example').DataTable({
            responsive: true
        });
    });
</script>
<script>
    $(document).on("click", ".btn-cancel", function () {
        var url = $(this).attr("data-url");
        var ID = $(this).next().val();
        var buyer_id = {$buyer_id};
        var SHOP_CODE ={$SHOP_CODE};
        if (confirm("确认选择ERP内码？")) {
            if(buyer_id){
                location.href = "{:U('ERPAPI/SelectYDCode')}?buyer_id={$buyer_id}&ID=" + ID;
            }
            if(SHOP_CODE){
                location.href = "{:U('ERPAPI/SelectYDCode')}?buyer_id={$SHOP_CODE}&GO={$GO}&ID=" + ID;
            }
        }
    });
</script>

</body>

</html>
